home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / include / pick.h < prev    next >
C/C++ Source or Header  |  1992-08-25  |  3KB  |  86 lines

  1. /* Copyright (c) 1992 The Geometry Center; University of Minnesota
  2.    1300 South Second Street;  Minneapolis, MN  55454, USA;
  3.    
  4. This file is part of geomview/OOGL. geomview/OOGL is free software;
  5. you can redistribute it and/or modify it only under the terms given in
  6. the file COPYING, which you should have received along with this file.
  7. This and other related software may be obtained via anonymous ftp from
  8. geom.umn.edu; email: software@geom.umn.edu. */
  9.  
  10. /* Authors: Charlie Gunn, Stuart Levy, Tamara Munzner, Mark Phillips */
  11.  
  12. #ifndef PICKDEF
  13. #define    PICKDEF
  14.  
  15. /*
  16.  * Public definitions for Geom Picking.
  17.  */
  18.  
  19. typedef struct Pick Pick;
  20.  
  21.                 /* Things to look for while picking
  22.                  * Specify PW_VERT|PW_EDGE|PW_FACE for all,
  23.                  * or a subset for more specific picks.
  24.                  * PW_VISIBLE checks Appearance to see what's
  25.                  * actually visible.
  26.                  */
  27. #define    PW_VERT    1
  28. #define    PW_EDGE    2
  29. #define    PW_FACE    4
  30. #define    PW_VISIBLE 8
  31.  
  32. #define    PA_END        100
  33. #define    PA_THRESH    101    /* float; x/y threshold (in projected space) */
  34. #define    PA_POINT    102    /* Point3 *; Picked 3D point (in object space) */
  35. #define    PA_DEPTH    103    /* float; depth (== PA_POINT's screen z component) */
  36.  
  37.                 /*
  38.                  * The following attributes are read-only
  39.                  */
  40. #define    PA_GPRIM    104    /* Geom *; geometric primitive picked if any */
  41. #define    PA_TPRIM    105    /* Transform; proj xform applying to PA_GPRIM */
  42. #define    PA_WANT        106    /* int; bitmask of desirable values */
  43.  
  44. #define PA_VERT        107    /* Point3 *; picked vertex, if any */
  45. #define PA_EDGE        108    /* Point3 e[2]; endpoints of picked
  46.                    edge, if any */
  47. #define PA_FACE        109    /* Point3 *; array of vertices of picked face,
  48.                    if any */
  49. #define PA_FACEN    110    /* number of elements in PA_FACE array; NOTE:
  50.                    when setting PA_FACE you must also set
  51.                    PA_FACEN. */
  52.  
  53. extern Pick *PickSet( Pick *, int attr, ... );
  54. extern int   PickGet( Pick *, int attr, void *attrp );
  55. extern void  PickDelete( Pick * );
  56.  
  57. /*
  58.  * Geometric Picking routines.
  59.  * GeomMousePick() is intended for normal use by application programs.
  60.  *   g is the root of the Geom tree
  61.  *   p is the Pick structure created by PickSet(), etc., or NULL for default;
  62.  *    If p!=NULL, it is modified in place, so results of the pick can be
  63.  *    retrieved by later PickGet() calls.
  64.  *   ap is the Appearance in effect when g is drawn, used to determine
  65.  *    visibility of features if PW_VISIBLE is set;
  66.  *   Tproj is the complete object-to-screen projection matrix;
  67.  *    it normally maps world coordinates in g's space to
  68.  *    the unit cube -1 <= {x, y, z} <= 1,
  69.  *    with z = -1 at the near and z = +1 at the far clipping plane,
  70.  *    x = y = 0 at the center of the screen;
  71.  *   xpick and ypick are the relative (-1 <= {x,y} <= 1) window
  72.  *    coordinates of the pick.
  73.  */
  74. extern Geom *GeomMousePick( Geom *g, Pick *p, Appearance *ap, Transform Tproj,
  75.                 double xpick, double ypick );
  76.  
  77. /*
  78.  * GeomPick() is an internal routine:
  79.  *    g, p, ap are as above for GeomMousePick.
  80.  *    T is adapted for convenience in pick calculations;
  81.  *    it is translated such that the pick goes through (x,y) = (0,0).
  82.  */
  83. extern Geom *GeomPick( Geom *g, Pick *p, Appearance *ap, Transform T );
  84.  
  85. #endif /*PICKDEF*/
  86.